<?php
/*========================================= JooSam =========================================/
/																							/
/	Extention:		JooSam																	/
/	Created by:		ScriptPlanet.eu															/
/	Site:			http://www.scriptplanet.eu												/
/	Email:			support@scriptplanet.eu													/
/	Support:		http://www.scriptplanet.eu/support										/
/	Copyright:		2011 (c) ScriptPlanet.eu												/
/	License:		CC BY-NC-ND 3.0 ~ http://creativecommons.org/licenses/by-nc-nd/3.0/		/
/	File Version:	0001																	/
/																							/
/========================================== JooSam ========================================*/
// Joomla Security
defined('_JEXEC') or die;
JHtml::_('behavior.tooltip');
$tzone = $this->tzone;
$song = $this->live;
$artist = utf8_encode($song['artist']);
$title = utf8_encode($song['title']);

date_default_timezone_set($tzone);
$reqstje = $song['requestID'];
$curtime = strtotime('now');
$started = $song['UNIX_TIMESTAMP(date_played)'];
$duration = $song['duration']/1000;
$end = $started+$duration;
$left = $end-$curtime;
$tleft = round($left);

if($tleft < 0){
	$smin = 0;
	$ssec = 20;
}
else{
	$smin = date('i', $tleft);
	$ssec = date('s', $tleft);
}
$samerr = $this->samerr;

?>


<div class="jsam_mod_live" id="jsam_live_mod"><?php
if($samerr == ''):
	if($reqstje != ''):
		echo $this->picture; ?>
		<div class="jsam_data">
			<table border="0" class="jsam_table">
				<tr class="jsam_row">
					<td class="jsam_td_artist">
						<?php echo JText::_('COM_JOOSAM_ARTIST'); ?>:
					</td>
					<td class="jsam_td_artist_data">
						<?php echo $artist; ?>
					</td>
				</tr>
				<tr class="jsam_row">
					<td class="jsam_td_title">
						<?php echo JText::_('COM_JOOSAM_TITLE'); ?>:
					</td>
					<td class="jsam_td_title_data">
						<?php echo $title; ?>
					</td>
				</tr>
				<tr class="jsam_row">
					<th colspan="2" class="jsam_th_timer">
						<input type="hidden" id="spCountMin" value="<?php echo $smin; ?>"/>
						<input type="hidden" id="spCountSec" value="<?php echo $ssec; ?>"/>
						<input type="hidden" id="spDurLeft" value="<?php echo $tleft; ?>"/>
						<input type="hidden" id="spDuration" value="<?php echo $duration; ?>"/>
						<input type="hidden" id="spIsRequest" value="<?php echo $reqstje; ?>"/>
						<div id="countje"></div>
					</th>
				</tr>
			</table>
		</div> <?php
	else: ?>
		<div>
			<input type="hidden" id="spCountMin" value="0"/>
			<input type="hidden" id="spCountSec" value="0"/>
			<input type="hidden" id="spDurLeft" value="0"/>
			<input type="hidden" id="spDuration" value="0"/>
			<input type="hidden" id="spIsRequest" value="-666"/>
		</div> <?php
	endif;
else: ?>
	<div style="background:white; color:red; font-weight:bold; border-radius:10px; margin:1px; text-align:center; padding:0;">
		<input type="hidden" id="spCountMin" value="0"/>
		<input type="hidden" id="spCountSec" value="0"/>
		<input type="hidden" id="spDurLeft" value="0"/>
		<input type="hidden" id="spDuration" value="0"/>
		<input type="hidden" id="spIsRequest" value="-333"/>
		<?php echo $samerr; ?>
	</div> <?php
endif;
?>
</div>